// 如果是供应商，显示上传商品连接按钮
if(userType=='2'){
    $('#uploading').show()
}
//动态添加商品
$('.new').click(function(){
    let url = webUrl + '/goods/xinpingoods'
    getGoods(url)
})
$('.hot').click(function(){
    let url = webUrl + '/goods/remengoods'
    getGoods(url)
})
$('.new').click()
function getGoods(url){
    $('.goodsbox').empty()
    $.ajax({
        type:'get',
        data:{
            page:1,
            size:8
        },
        url:url,
        dataType:'json',
        success:function(data){
            let goodsList = data.content.content;
            for(let i=0;i<goodsList.length;i++){
                let obj =  `<div class="col-lg-3">
                                    <div class="product-box">
                                        <div class="imagebox">                            
                                            <ul class="box-image owl-carousel-1">
                                                <li>
                                                    <a href="goodsInfo.html?goodsId=`+goodsList[i].goodsId+`" title="">
                                                        <img src="`+goodsList[i].productPicture+`" alt="">
                                                    </a>
                                                </li>
                                            </ul>
                                            <span class="item-new">NEW</span>
                                            <div class="box-content">
                                                <div class="cat-name">
                                                    <a href="#" title="">`+goodsList[i].brandName+`</a>
                                                </div>
                                                <div class="product-name">
                                                    <a href="#" title="">`+goodsList[i].commodityName+`</a>
                                                </div>
                                                <div class="price">
                                                    <span class="sale">`+goodsList[i].price+`</span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>                        
                            </div>`
                $('.goodsbox').append(obj)
            }
        }

    })
}


